package cn.bqjr.eily.shiro.spring.boot;

import cn.bqjr.eily.shiro.spring.boot.entity.ShiroProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class RedisLoginRetryMgr extends AbstractLoginRetryMgr {

    @Autowired
    private RedisLoginRetryCache loginRetryCache;

    @Autowired
    private ShiroProperties properties;

    @PostConstruct
    public void init() {
        setEnabledLoginRetryLimit(properties.getLoginRetry().getEnabledLoginRetryLimit());
        setLoginRetryLimitCount(properties.getLoginRetry().getLoginRetryLimitCount());
        setLoginRetryLimitTime(properties.getLoginRetry().getLoginRetryLimitTime());
        setLoginRetryLockTime(properties.getLoginRetry().getLoginRetryLockTime());
        setLoginRetryCache(loginRetryCache);
    }
}
